import Layout from '@/layout'

const collegeRouter = {
  path: '/college',
  component: Layout,
  redirect: '/college/add',
  name: 'College',
  meta: {
    title: '学院管理',
    icon: 'component',
    roles: ['admin']
  },
  children: [
    {
      path: 'add',
      name: 'AddCollege',
      component: () => import('@/views/admin/college/add'),
      meta: { title: '新增学院', roles: ['admin'] }
    },
    {
      path: 'view',
      name: 'ViewCollege',
      component: () => import('@/views/admin/college/view'),
      meta: { title: '查看学院', roles: ['admin'] }
    }
  ]
}

const majorRouter = {
  path: '/major',
  component: Layout,
  redirect: '/major/add',
  name: 'Major',
  meta: {
    title: '专业管理',
    icon: 'example',
    roles: ['admin']
  },
  children: [
    {
      path: 'add',
      name: 'AddMajor',
      component: () => import('@/views/admin/major/add'),
      meta: { title: '新增专业', roles: ['admin'] }
    },
    {
      path: 'view',
      name: 'ViewMajor',
      component: () => import('@/views/admin/major/view'),
      meta: { title: '查看专业', roles: ['admin'] }
    }
  ]
}

const classRouter = {
  path: '/class',
  component: Layout,
  redirect: '/class/add',
  name: 'Class',
  meta: {
    title: '班级管理',
    icon: 'peoples',
    roles: ['admin']
  },
  children: [
    {
      path: 'add',
      name: 'AddClass',
      component: () => import('@/views/admin/class/add'),
      meta: { title: '新增班级', roles: ['admin'] }
    },
    {
      path: 'view',
      name: 'ViewClass',
      component: () => import('@/views/admin/class/view'),
      meta: { title: '查看班级', roles: ['admin'] }
    }
  ]
}

const userRouter = {
  path: '/user',
  component: Layout,
  redirect: '/user/add',
  name: 'User',
  meta: {
    title: '账号管理',
    icon: 'user',
    roles: ['admin']
  },
  children: [
    {
      path: 'add',
      name: 'AddUser',
      component: () => import('@/views/admin/user/add'),
      meta: { title: '新增账号', roles: ['admin'] }
    },
    {
      path: 'view',
      name: 'ViewUser',
      component: () => import('@/views/admin/user/view'),
      meta: { title: '查看账号', roles: ['admin'] }
    }
  ]
}

const adminRouter = [collegeRouter, majorRouter, classRouter, userRouter]

export default adminRouter
